home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 28
/
Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso
/
Aminet
/
dev
/
amos
/
intuiextend16.lha
/
bonus
/
makelib
/
MakeLib_example1.amos
/
MakeLib_example1.amosSourceCode
Wrap
AMOS Source Code
|
1980-01-04
|
1KB
|
95 lines
'
' Make_Lib Example 1, showing use of:
'
' ma Malloc, ma Free All, ma AddHead, ma Next, ma Prev, ma First
' and ma Last
'
'
NODES=14
' MEM_FREE
LIST_CREATE[NODES]
LIST_SHOW[Param]
CLEAN_UP
'
' Clean up routine, frees all malloc'ed memory with one ma Free All
' command
'
Procedure CLEAN_UP
Extension_17_00D0
' MEM_FREE
Wait Key
Edit
End Proc
'
' Shows current free memory (chip and fast)
'
Procedure MEM_FREE
Print "CHIP: "+Str$(Chip Free)+" FAST: "+Str$(Fast Free)
End Proc
'
' Shows created list
'
Procedure LIST_SHOW[LIST]
Print "ALL NODES BEGIN --> END"
NODE= Extension_17_00FE(LIST)
While NODE
Print Deek(NODE+8)
NODE= Extension_17_00E2(NODE)
Wend
'
' And same backwards!
'
Print "ALL NODES END --> BEGIN"
NODE= Extension_17_010E(LIST)
While NODE
Print Deek(NODE+8)
NODE= Extension_17_00F0(NODE)
Wend
End Proc
'
' Creates list including NODES number of nodes :)
'
Procedure LIST_CREATE[NODES]
'
' First Malloc list header (12 bytes!)
'
LIST= Extension_17_00B0(12,0)
If LIST Then Extension_17_002E LIST Else CLEAN_UP
'
' Then Malloc all nodes and add them into list (Node header = 8 bytes + 2
' bytes for word containing number of node .. :)
'
For A=1 To NODES
NODE= Extension_17_00B0(8+2,0)
If NODE
Doke NODE+8,A
Extension_17_0064 LIST,NODE
Else
CLEAN_UP
End If
Next
End Proc[LIST]